package com.qfedu.index.tolist.service.controller;

import com.qfedu.entity.Room;
import com.qfedu.index.tolist.service.service.RoomListService;
import com.qfedu.vo.ResultVo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class RoomListController {

    @Resource
    private RoomListService roomListService;

    @RequestMapping("/getRoomByRid")
    public ResultVo getRoomByRid(Integer rid){
        Room room = roomListService.getRoomByRid(rid);
        return ResultVo.getSuccessResultVo("查询成功",room);
    }

    @RequestMapping("/getRoomByCid")
    public ResultVo getRoomByCid(Integer cid){
        List<Room> rooms = roomListService.selectRoomByCityId(cid);
        return ResultVo.getSuccessResultVo("查询成功",rooms);
    }

    @RequestMapping("/getRoomsBySpId")
    public ResultVo getRoomsBySpId(Integer specialId,Integer pageNum,Integer paSize){
        List<Room> rooms = roomListService.getRoomsBySpId(specialId,pageNum,paSize);
        return ResultVo.getSuccessResultVo("查询成功",rooms);
    }
}
